<template>
<div>
    <h1>收银组件</h1>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="餐桌号查询">
          <el-input v-model="formInline.user" placeholder="请输入餐桌号"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="getdata">重置</el-button>
          <el-button type="primary" >查询</el-button>
        </el-form-item>
    </el-form>
    <el-table :data="orderData" border style="width: 100%">
        <el-table-column prop="food_table_number" label="桌号" min-width="180"></el-table-column>
        <el-table-column prop="food_name" label="菜品" min-width="180"></el-table-column>
        <el-table-column prop="address" label="小计" min-width="180"></el-table-column>
        <el-table-column label="操作" min-width="200">
            <template>
                <el-button type="primary">删除</el-button>
                <el-button type="primary">新增</el-button>
            </template>
        </el-table-column>
    </el-table>
    <!-- <div>{{this.$route.query.id}}</div> -->
</div>
</template>

<script>
// this.$route.query.id这样接收点菜界面传递过来的值
import * as api from "../utils/api.js";
export default {
    data() {
        return {
            orderData: [],
            formInline:{
                user: '',
                region: ''
            }
        };
    },
    created() {
        this.getdata();
    },
    methods: {
        getdata() {
            this.axios({
                url: api.GET_SELECTAllORDERINGFOOD,
                method: "get",
                params: {},
            }).then((data) => {
                let a=[]
                // data.data.data[i].ordering_food_account===0&&
                if (data.data.code === 200) {
                    for(let i=0;i<data.data.data.length;i++){
                      if(data.data.data[i].food_table_account===0){
                        a.push(data.data.data[i]);
                        this.orderData=a
                      }
                    }
                    
                }
                console.log(data.data);
            }).ch;
        },
    },
};
</script>

<style>
</style>
